// Copyright (C) 2010 David Sugar, Tycho Softworks.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#include <apennine-config.h>
#include <apennine/apennine.h>

namespace apennine {

#ifdef  HAVE_SIGWAIT
#include <signal.h>

class __LOCAL psignals : private JoinableThread
{
private:
    bool shutdown;
    bool started;

    sigset_t sigs;

    void run(void);
    void cancel(void);

    psignals();
    ~psignals();

    static psignals thread;

public:
    static void service(const char *name);
    static void setup(void);
    static void start(void);
    static void stop(void);
};

#else

class __LOCAL psignals
{
public:
    static void service(const char *name);
    static void setup(void);
    static void start(void);
    static void stop(void);
};
#endif

class __LOCAL control
{
public:
    static void request(const char *string);
    static void run(void);
};

} // end namespace
